
package cz.czu.pef.DataModelling.beans;

import java.util.*;
import java.util.logging.*;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import cz.czu.pef.DataModelling.ejb.api.DataModellingEjbInterface;


@Component
@ViewScoped
@ManagedBean
public class DataModellingBean implements ApplicationContextAware
{

  @SuppressWarnings("unused")
  private static final long serialVersionUID = 6469829375417092825L;

  public static final Logger logger = Logger.getLogger(DataModellingBean.class.getName());
  private ApplicationContext applicationContext;
  private DataModellingEjbInterface dataModellingEjb;

  public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
  {
    this.applicationContext = applicationContext;
  }

  @PostConstruct
  public void create()
  {
    dataModellingEjb = this.applicationContext.getBean(DataModellingEjbInterface.class);
  }

  public List<Object[]> getAllMissingTrainings()
  {
    return dataModellingEjb.getAllMissingTrainings();
  }

  public List<Object[]> getAllMissingMedicalExaminations()
  {
    return dataModellingEjb.getAllMissingMedicalExaminations();
  }

  public List<Object[]> getAllMachineryWorkers()
  {
    return dataModellingEjb.getAllMachineryWorkers();
  }
}
